package com.cy.law.sys;


import com.cy.law.filter.BaseFilter;
import com.cy.law.filter.SessionFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @SuppressWarnings("unchecked")
    @Bean
    public FilterRegistrationBean testFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new BaseFilter());
        registration.addUrlPatterns("/*");
        registration.setName("BaseFilter");
        registration.setOrder(1);
        return registration;
    }

    @SuppressWarnings("unchecked")
    @Bean
    public FilterRegistrationBean authFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new SessionFilter());
        registration.addUrlPatterns("/home/*");
        registration.setName("SessionFilter");
        registration.setOrder(2);
        return registration;
    }
}